<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>如何搭建自己的个人博客网站 | 洛沐の人间客栈</title><meta name="keywords" content="Hexo"><meta name="author" content="洛沐,guojiaxiang0820@gmail.com"><meta name="copyright" content="洛沐"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="这是一个自建Hexo静态博客网站的记录，其中包括环境配置，命令输入，以及远端部署。基于MacOS系统，Win系统类似。">
<meta property="og:type" content="article">
<meta property="og:title" content="如何搭建自己的个人博客网站">
<meta property="og:url" content="https://www.guojxblog.cn/archives/23cd4859.html">
<meta property="og:site_name" content="洛沐の人间客栈">
<meta property="og:description" content="这是一个自建Hexo静态博客网站的记录，其中包括环境配置，命令输入，以及远端部署。基于MacOS系统，Win系统类似。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/bg_rabbit.jpg">
<meta property="article:published_time" content="2021-03-06T12:01:11.000Z">
<meta property="article:modified_time" content="2023-01-18T14:47:32.660Z">
<meta property="article:author" content="洛沐">
<meta property="article:tag" content="Hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/bg_rabbit.jpg"><link rel="shortcut icon" href="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/RS_icon.jpg"><link rel="canonical" href="https://www.guojxblog.cn/archives/23cd4859"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><meta name="baidu-site-verification" content="code-zGPrfnFp7y"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: {"limitDay":180,"position":"top","messagePrev":"此文中创建于","messageNext":"天之前，请以最新文章为准！"},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":500},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: true
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: 洛沐","link":"链接: ","source":"来源: 洛沐の人间客栈","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'mediumZoom',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isAnchor: true
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '如何搭建自己的个人博客网站',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-01-18 22:47:32'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="/css/style.css"><link rel="stylesheet" href="/css/iconfont.css"><link rel="stylesheet" href="/css/font-awesome.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/sviptzk/StaticFile_HEXO@latest/butterfly/css/macblack.css"><script src="/live2d-widget/autoload.js"></script><meta name="generator" content="Hexo 6.1.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/loading3.gif" data-original="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/touxiang.jpeg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">29</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">18</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">7</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa fa-graduation-cap"></i><span> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-archive"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li></ul></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa-solid fa-heart-pulse"></i><span> 生活</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/books/"><i class="fa-fw fas fa-book-reader"></i><span> 读书</span></a></li><li><a class="site-page child" href="/photos/"><i class="fa-fw fa fa-camera-retro"></i><span> 相册</span></a></li><li><a class="site-page child" href="/music/"><i class="fa-fw fa fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 影视</span></a></li></ul></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa-solid fa-keyboard"></i><span> 动态</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/comment/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言</span></a></li><li><a class="site-page child" href="/notes/"><i class="fa-fw fas fa-feather-alt"></i><span> 随笔</span></a></li><li><a class="site-page child" href="/ideas/"><i class="fa-fw fa-solid fa-lightbulb"></i><span> 妙想</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/bg_rabbit.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">洛沐の人间客栈</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa fa-graduation-cap"></i><span> 文章</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-archive"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li></ul></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa-solid fa-heart-pulse"></i><span> 生活</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/books/"><i class="fa-fw fas fa-book-reader"></i><span> 读书</span></a></li><li><a class="site-page child" href="/photos/"><i class="fa-fw fa fa-camera-retro"></i><span> 相册</span></a></li><li><a class="site-page child" href="/music/"><i class="fa-fw fa fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 影视</span></a></li></ul></div><div class="menus_item"><a class="site-page group hide" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fa-solid fa-keyboard"></i><span> 动态</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/comment/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言</span></a></li><li><a class="site-page child" href="/notes/"><i class="fa-fw fas fa-feather-alt"></i><span> 随笔</span></a></li><li><a class="site-page child" href="/ideas/"><i class="fa-fw fa-solid fa-lightbulb"></i><span> 妙想</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">如何搭建自己的个人博客网站</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-03-06T12:01:11.000Z" title="发表于 2021-03-06 20:01:11">2021-03-06</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-01-18T14:47:32.660Z" title="更新于 2023-01-18 22:47:32">2023-01-18</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%8D%9A%E5%AE%A2%E6%90%AD%E5%BB%BA/">博客搭建</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">222</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>1分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="如何搭建自己的个人博客网站"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h2 id="下载并安装git-nodeJS框架"><a href="#下载并安装git-nodeJS框架" class="headerlink" title="下载并安装git nodeJS框架"></a>下载并安装git nodeJS框架</h2><h2 id="打开终端，进入root模式，命令行：sudo-su"><a href="#打开终端，进入root模式，命令行：sudo-su" class="headerlink" title="打开终端，进入root模式，命令行：sudo su"></a>打开终端，进入root模式，命令行：sudo su</h2><h3 id="输入密码回车"><a href="#输入密码回车" class="headerlink" title="输入密码回车"></a>输入密码回车</h3><h2 id="利用npm安装包管理器cnpm达到提速的目的，命令行：npm-install-g-cnpm-–registry-x3D-https-registry-npm-taobao-org"><a href="#利用npm安装包管理器cnpm达到提速的目的，命令行：npm-install-g-cnpm-–registry-x3D-https-registry-npm-taobao-org" class="headerlink" title="利用npm安装包管理器cnpm达到提速的目的，命令行：npm install -g cnpm –registry&#x3D;https://registry.npm.taobao.org"></a>利用npm安装包管理器cnpm达到提速的目的，命令行：npm install -g cnpm –registry&#x3D;<a target="_blank" rel="noopener external nofollow noreferrer" href="https://registry.npm.taobao.org/">https://registry.npm.taobao.org</a></h2><h2 id="利用cnpm安装hexo，命令行：cnpm-install-g-hexo-cli"><a href="#利用cnpm安装hexo，命令行：cnpm-install-g-hexo-cli" class="headerlink" title="利用cnpm安装hexo，命令行：cnpm install -g hexo-cli"></a>利用cnpm安装hexo，命令行：cnpm install -g hexo-cli</h2><h2 id="新建空文件夹，命令行：mkdir-blog"><a href="#新建空文件夹，命令行：mkdir-blog" class="headerlink" title="新建空文件夹，命令行：mkdir blog"></a>新建空文件夹，命令行：mkdir blog</h2><h2 id="进入博客，命令行：cd-blog"><a href="#进入博客，命令行：cd-blog" class="headerlink" title="进入博客，命令行：cd blog"></a>进入博客，命令行：cd blog</h2><h2 id="利用hexo初始化一个博客，命令行：sudo-hexo-init"><a href="#利用hexo初始化一个博客，命令行：sudo-hexo-init" class="headerlink" title="利用hexo初始化一个博客，命令行：sudo hexo init"></a>利用hexo初始化一个博客，命令行：sudo hexo init</h2><h2 id="本地启动，命令行：hexo-s"><a href="#本地启动，命令行：hexo-s" class="headerlink" title="本地启动，命令行：hexo s"></a>本地启动，命令行：hexo s</h2><h3 id="浏览器：localhost-4000端口打开"><a href="#浏览器：localhost-4000端口打开" class="headerlink" title="浏览器：localhost:4000端口打开"></a>浏览器：localhost:4000端口打开</h3><h2 id="新建一篇博客文章，命令行：hexo-n-“博客文章”"><a href="#新建一篇博客文章，命令行：hexo-n-“博客文章”" class="headerlink" title="新建一篇博客文章，命令行：hexo n “博客文章”"></a>新建一篇博客文章，命令行：hexo n “博客文章”</h2><h3 id="cd-到文件夹下，用vim打开，命令行：vim-博客文章-md"><a href="#cd-到文件夹下，用vim打开，命令行：vim-博客文章-md" class="headerlink" title="cd 到文件夹下，用vim打开，命令行：vim 博客文章.md"></a>cd 到文件夹下，用vim打开，命令行：vim 博客文章.md</h3><h2 id="保存退出，命令行：esc-wq或者Ctl-C"><a href="#保存退出，命令行：esc-wq或者Ctl-C" class="headerlink" title="保存退出，命令行：esc :wq或者Ctl+C"></a>保存退出，命令行：esc :wq或者Ctl+C</h2><h3 id="cd到根目录-x2F-blog下"><a href="#cd到根目录-x2F-blog下" class="headerlink" title="cd到根目录&#x2F;blog下"></a>cd到根目录&#x2F;blog下</h3><h2 id="hexo-clean清除一下目录"><a href="#hexo-clean清除一下目录" class="headerlink" title="hexo clean清除一下目录"></a>hexo clean清除一下目录</h2><h2 id="hexo-g或者hexo-generate，更新"><a href="#hexo-g或者hexo-generate，更新" class="headerlink" title="hexo g或者hexo generate，更新"></a>hexo g或者hexo generate，更新</h2><h2 id="hexo-s或者hexo-server，部署到本地服务器上"><a href="#hexo-s或者hexo-server，部署到本地服务器上" class="headerlink" title="hexo s或者hexo server，部署到本地服务器上"></a>hexo s或者hexo server，部署到本地服务器上</h2><h2 id="hexo-d或者hexo-deploy，部署到远端托管"><a href="#hexo-d或者hexo-deploy，部署到远端托管" class="headerlink" title="hexo d或者hexo deploy，部署到远端托管"></a>hexo d或者hexo deploy，部署到远端托管</h2><blockquote>
<p>持续更新中…</p>
</blockquote>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:guojiaxiang0820@gmail.com" rel="external nofollow noreferrer">洛沐</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://www.guojxblog.cn/archives/23cd4859.html">https://www.guojxblog.cn/archives/23cd4859.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://www.guojxblog.cn" target="_blank">洛沐の人间客栈</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Hexo/">Hexo</a></div><div class="post_share"><div class="social-share" data-image="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/bg_rabbit.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/wechat.jpeg" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/loading3.gif" data-original="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/wechat.jpeg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/alipay.jpeg" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/loading3.gif" data-original="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/alipay.jpeg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/archives/266295d8.html"><img class="prev-cover" src="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/loading3.gif" data-original="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/gongyuanxun.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">中国内陆Google搜索使用</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/archives/573e690a.html" title="Hello Hexo--Hexo 初步运行指令"><img class="cover" src="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/loading3.gif" data-original="https://luomublog.oss-cn-qingdao.aliyuncs.com/ImgHost/bg_archer.jpeg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-04-23</div><div class="title">Hello Hexo--Hexo 初步运行指令</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="lv-container" data-id="city" data-uid="MTAyMC81NjIzOS8zMjcwMg=="></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%8B%E8%BD%BD%E5%B9%B6%E5%AE%89%E8%A3%85git-nodeJS%E6%A1%86%E6%9E%B6"><span class="toc-number">1.</span> <span class="toc-text">下载并安装git nodeJS框架</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%89%93%E5%BC%80%E7%BB%88%E7%AB%AF%EF%BC%8C%E8%BF%9B%E5%85%A5root%E6%A8%A1%E5%BC%8F%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Asudo-su"><span class="toc-number">2.</span> <span class="toc-text">打开终端，进入root模式，命令行：sudo su</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E8%BE%93%E5%85%A5%E5%AF%86%E7%A0%81%E5%9B%9E%E8%BD%A6"><span class="toc-number">2.1.</span> <span class="toc-text">输入密码回车</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%A9%E7%94%A8npm%E5%AE%89%E8%A3%85%E5%8C%85%E7%AE%A1%E7%90%86%E5%99%A8cnpm%E8%BE%BE%E5%88%B0%E6%8F%90%E9%80%9F%E7%9A%84%E7%9B%AE%E7%9A%84%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Anpm-install-g-cnpm-%E2%80%93registry-x3D-https-registry-npm-taobao-org"><span class="toc-number">3.</span> <span class="toc-text">利用npm安装包管理器cnpm达到提速的目的，命令行：npm install -g cnpm –registry&#x3D;https:&#x2F;&#x2F;registry.npm.taobao.org</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%A9%E7%94%A8cnpm%E5%AE%89%E8%A3%85hexo%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Acnpm-install-g-hexo-cli"><span class="toc-number">4.</span> <span class="toc-text">利用cnpm安装hexo，命令行：cnpm install -g hexo-cli</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%B0%E5%BB%BA%E7%A9%BA%E6%96%87%E4%BB%B6%E5%A4%B9%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Amkdir-blog"><span class="toc-number">5.</span> <span class="toc-text">新建空文件夹，命令行：mkdir blog</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E8%BF%9B%E5%85%A5%E5%8D%9A%E5%AE%A2%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Acd-blog"><span class="toc-number">6.</span> <span class="toc-text">进入博客，命令行：cd blog</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%88%A9%E7%94%A8hexo%E5%88%9D%E5%A7%8B%E5%8C%96%E4%B8%80%E4%B8%AA%E5%8D%9A%E5%AE%A2%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Asudo-hexo-init"><span class="toc-number">7.</span> <span class="toc-text">利用hexo初始化一个博客，命令行：sudo hexo init</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%9C%AC%E5%9C%B0%E5%90%AF%E5%8A%A8%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Ahexo-s"><span class="toc-number">8.</span> <span class="toc-text">本地启动，命令行：hexo s</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%B5%8F%E8%A7%88%E5%99%A8%EF%BC%9Alocalhost-4000%E7%AB%AF%E5%8F%A3%E6%89%93%E5%BC%80"><span class="toc-number">8.1.</span> <span class="toc-text">浏览器：localhost:4000端口打开</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%96%B0%E5%BB%BA%E4%B8%80%E7%AF%87%E5%8D%9A%E5%AE%A2%E6%96%87%E7%AB%A0%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Ahexo-n-%E2%80%9C%E5%8D%9A%E5%AE%A2%E6%96%87%E7%AB%A0%E2%80%9D"><span class="toc-number">9.</span> <span class="toc-text">新建一篇博客文章，命令行：hexo n “博客文章”</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#cd-%E5%88%B0%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%EF%BC%8C%E7%94%A8vim%E6%89%93%E5%BC%80%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Avim-%E5%8D%9A%E5%AE%A2%E6%96%87%E7%AB%A0-md"><span class="toc-number">9.1.</span> <span class="toc-text">cd 到文件夹下，用vim打开，命令行：vim 博客文章.md</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BF%9D%E5%AD%98%E9%80%80%E5%87%BA%EF%BC%8C%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%9Aesc-wq%E6%88%96%E8%80%85Ctl-C"><span class="toc-number">10.</span> <span class="toc-text">保存退出，命令行：esc :wq或者Ctl+C</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#cd%E5%88%B0%E6%A0%B9%E7%9B%AE%E5%BD%95-x2F-blog%E4%B8%8B"><span class="toc-number">10.1.</span> <span class="toc-text">cd到根目录&#x2F;blog下</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hexo-clean%E6%B8%85%E9%99%A4%E4%B8%80%E4%B8%8B%E7%9B%AE%E5%BD%95"><span class="toc-number">11.</span> <span class="toc-text">hexo clean清除一下目录</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hexo-g%E6%88%96%E8%80%85hexo-generate%EF%BC%8C%E6%9B%B4%E6%96%B0"><span class="toc-number">12.</span> <span class="toc-text">hexo g或者hexo generate，更新</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hexo-s%E6%88%96%E8%80%85hexo-server%EF%BC%8C%E9%83%A8%E7%BD%B2%E5%88%B0%E6%9C%AC%E5%9C%B0%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A"><span class="toc-number">13.</span> <span class="toc-text">hexo s或者hexo server，部署到本地服务器上</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#hexo-d%E6%88%96%E8%80%85hexo-deploy%EF%BC%8C%E9%83%A8%E7%BD%B2%E5%88%B0%E8%BF%9C%E7%AB%AF%E6%89%98%E7%AE%A1"><span class="toc-number">14.</span> <span class="toc-text">hexo d或者hexo deploy，部署到远端托管</span></a></li></ol></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2021 - 2023  <i id="heartbeat" class="fa fas fa-heartbeat"></i> 洛沐</div><div class="footer_custom_text">谢谢你来看<a href="https://www.guojxblog.cn/" style='color:red;Font-size:36'>我</a>，你今天真好看😘</div></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HCLonely/images@master/others/heartbeat.min.css"></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">簡</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">本地搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function loadLivere () {
  if (typeof LivereTower === 'object') {
    window.LivereTower.init()
  }
  else {
    (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
    })(document, 'script');
  }
}

if ('Livere' === 'Livere' || !true) {
  if (true) btf.loadComment(document.getElementById('lv-container'), loadLivere)
  else loadLivere()
}
else {
  function loadOtherComment () {
    loadLivere()
  }
}</script></div><script src="/js/mobile_side.js"></script><script id="click-heart" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js" async="async" mobile="true"></script><div class="pjax-reload"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '1s');
    arr[i].setAttribute('data-wow-delay', '700ms');
    arr[i].setAttribute('data-wow-offset', '100');
    arr[i].setAttribute('data-wow-iteration', '1');
}</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
}</script></div><script defer="defer" src="https://cdn.jsdelivr.net/gh/graingert/wow@1.3.0/dist/wow.min.js"></script><script defer="defer" src="/js/wow_init.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script>
            window.imageLazyLoadSetting = {
                isSPA: true,
                preloadRatio: 3,
                processImages: null,
            };
        </script><script>window.addEventListener("load",function(){var t=/\.(gif|jpg|jpeg|tiff|png)$/i,r=/^data:image\/[a-z]+;base64,/;Array.prototype.slice.call(document.querySelectorAll("img[data-original]")).forEach(function(a){var e=a.parentNode;"A"===e.tagName&&(e.href.match(t)||e.href.match(r))&&(e.href=a.dataset.original)})});</script><script>!function(n){n.imageLazyLoadSetting.processImages=o;var e=n.imageLazyLoadSetting.isSPA,i=n.imageLazyLoadSetting.preloadRatio||1,r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]"));function o(){e&&(r=Array.prototype.slice.call(document.querySelectorAll("img[data-original]")));for(var t,a=0;a<r.length;a++)0<=(t=(t=r[a]).getBoundingClientRect()).bottom&&0<=t.left&&t.top<=(n.innerHeight*i||document.documentElement.clientHeight*i)&&function(){var t,e,n,i,o=r[a];t=o,e=function(){r=r.filter(function(t){return o!==t})},n=new Image,i=t.getAttribute("data-original"),n.onload=function(){t.src=i,e&&e()},t.src!==i&&(n.src=i)}()}o(),n.addEventListener("scroll",function(){var t,e;t=o,e=n,clearTimeout(t.tId),t.tId=setTimeout(function(){t.call(e)},500)})}(this);</script><script async>window.onload=function(){var a=document.createElement('script'),b=document.getElementsByTagName('script')[0];a.type='text/javascript',a.async=!0,a.src='/sw-register.js?v='+Date.now(),b.parentNode.insertBefore(a,b)};</script></body></html>